package com.ygl.core.nacos.adapter;


import com.alibaba.cloud.nacos.ribbon.NacosServer;
import com.netflix.loadbalancer.Server;
import com.ygl.core.adapter.AbstractCoreAdapter;

import java.util.Map;

/**
 * author: yanggld
 * date: 2019/12/14 12:49
 * version: 1.0
 * description: NacosAdapter
 */
public class NacosAdapter extends AbstractCoreAdapter {

    @Override
    public Map<String, String> getServerMetadata(Server server) {

        if (server instanceof NacosServer) {
            NacosServer nacosServer = (NacosServer) server;
            return nacosServer.getMetadata();
        }
        throw new RuntimeException("Server instance isn't the type of NacosServer");
    }

}
